local skel = fk.CreateSkill {
  name = "efengqi__qingguo",
  tags = {Skill.Compulsory},
}

Fk:loadTranslationTable{
  ["efengqi__qingguo"] = "倾国",
  [":efengqi__qingguo"] = "锁定技，你的前三个阶段改为摸一张牌。你可以将黑色手牌当【闪】使用或打出。",

  ["#efengqi__qingguo"] = "倾国：你可以将黑色手牌当【闪】使用或打出",

  ["$efengqi__qingguo1"] = "凌波微步，罗袜生尘。",
  ["$efengqi__qingguo2"] = "体迅飞凫，飘忽若神。",
}

skel:addEffect("viewas", {
  anim_type = "defensive",
  pattern = "jink",
  prompt = "#efengqi__qingguo",
  handly_pile = true,
  card_filter = function (self, player, to_select, selected)
    if #selected == 1 then return false end
    return Fk:getCardById(to_select).color == Card.Black and table.contains(player:getHandlyIds(true), to_select)
  end,
  view_as = function (self, player, cards)
    if #cards ~= 1 then return nil end
    local c = Fk:cloneCard("jink")
    c.skillName = skel.name
    c:addSubcard(cards[1])
    return c
  end,
})

skel:addEffect(fk.EventPhaseChanging, {
  anim_type = "drawcard",
  can_trigger = function(self, event, target, player, data)
    local turn = player.room.logic:getCurrentEvent():findParent(GameEvent.Turn, true)
    if turn == nil then return end
    if target == player and player:hasSkill(skel.name) and not data.skipped then
      return turn.data.phase_index <= 3
    end
  end,
  on_use = function(self, event, target, player, data)
    data.skipped = true -- 跳过阶段还是终止阶段好呢？
    player:drawCards(1, skel.name)
  end,
})

return skel
